public class DemoBehaviour : MonoBehaviour {
public GameObject otherGameObject;
public void Foo() {
StartCoroutine(TemporarilyDeactivate(20));
}
private IEnumerator TemporarilyDeactivate(float duration) {
otherGameObject.SetActive(false);
yield return new WaitForSeconds(duration);
otherGameObject.SetActive(true);
}
}